package api

import (
	"client/global"
	"github.com/gin-gonic/gin"
	"server/proto"
)

func CreateIkIndex(c *gin.Context) {
	index := c.PostForm("index")
	_, err := global.RpcClient.CreateIkIndex(c, &proto.CreateIkIndexReq{
		Index: index,
	})
	if err != nil {
		c.JSON(200, gin.H{
			"code": -1,
			"msg":  err.Error(),
		})
		return
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "索引建立成功",
	})
	return
}
